package com.ruoyi.qbms.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.qbms.domain.vo.QbmsRankVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.qbms.mapper.QbmsRecordAnswerMapper;
import com.ruoyi.qbms.domain.QbmsRecordAnswer;
import com.ruoyi.qbms.service.IQbmsRecordAnswerService;

/**
 * 题库答题记录Service业务层处理
 * 
 * @author zouhuu
 * @date 2022-10-19
 */
@Service
public class QbmsRecordAnswerServiceImpl implements IQbmsRecordAnswerService 
{
    @Autowired
    private QbmsRecordAnswerMapper qbmsRecordAnswerMapper;

    /**
     * 查询题库答题记录
     * 
     * @param id 题库答题记录主键
     * @return 题库答题记录
     */
    @Override
    public QbmsRecordAnswer selectQbmsRecordAnswerById(Long id)
    {
        return qbmsRecordAnswerMapper.selectQbmsRecordAnswerById(id);
    }

    /**
     * 查询题库答题记录列表
     * 
     * @param qbmsRecordAnswer 题库答题记录
     * @return 题库答题记录
     */
    @Override
    public List<QbmsRecordAnswer> selectQbmsRecordAnswerList(QbmsRecordAnswer qbmsRecordAnswer)
    {
        return qbmsRecordAnswerMapper.selectQbmsRecordAnswerList(qbmsRecordAnswer);
    }

    /**
     * 查询答题排名
     * @param qbmsRecordAnswer
     * @return
     */
    @Override
    public List<QbmsRankVo> selectAnswerRankList(QbmsRecordAnswer qbmsRecordAnswer) {
        return qbmsRecordAnswerMapper.selectAnswerRankList(qbmsRecordAnswer);
    }

    /**
     * 查询数量
     * @param qbmsRecordAnswer
     * @return
     */
    @Override
    public int selectNums(QbmsRecordAnswer qbmsRecordAnswer) {
        return qbmsRecordAnswerMapper.selectNums(qbmsRecordAnswer);
    }

    /**
     * 查询答题人数
     * @param qbmsRecordAnswer
     * @return
     */
    @Override
    public int selectUserNums(QbmsRecordAnswer qbmsRecordAnswer) {
        return qbmsRecordAnswerMapper.selectUserNums(qbmsRecordAnswer);
    }

    /**
     * 新增题库答题记录
     * 
     * @param qbmsRecordAnswer 题库答题记录
     * @return 结果
     */
    @Override
    public int insertQbmsRecordAnswer(QbmsRecordAnswer qbmsRecordAnswer)
    {
        qbmsRecordAnswer.setCreateTime(DateUtils.getNowDate());
        return qbmsRecordAnswerMapper.insertQbmsRecordAnswer(qbmsRecordAnswer);
    }

    /**
     * 修改题库答题记录
     * 
     * @param qbmsRecordAnswer 题库答题记录
     * @return 结果
     */
    @Override
    public int updateQbmsRecordAnswer(QbmsRecordAnswer qbmsRecordAnswer)
    {
        qbmsRecordAnswer.setUpdateTime(DateUtils.getNowDate());
        return qbmsRecordAnswerMapper.updateQbmsRecordAnswer(qbmsRecordAnswer);
    }

    /**
     * 批量更新状态
     * @param qbmsRecordAnswer
     * @return
     */
    @Override
    public int batchUpdateStatus(QbmsRecordAnswer qbmsRecordAnswer) {
        return qbmsRecordAnswerMapper.batchUpdateStatus(qbmsRecordAnswer);
    }

    /**
     * 批量删除题库答题记录
     * 
     * @param ids 需要删除的题库答题记录主键
     * @return 结果
     */
    @Override
    public int deleteQbmsRecordAnswerByIds(Long[] ids)
    {
        return qbmsRecordAnswerMapper.deleteQbmsRecordAnswerByIds(ids);
    }

    /**
     * 删除题库答题记录信息
     * 
     * @param id 题库答题记录主键
     * @return 结果
     */
    @Override
    public int deleteQbmsRecordAnswerById(Long id)
    {
        return qbmsRecordAnswerMapper.deleteQbmsRecordAnswerById(id);
    }
}
